The present invention relates in general to database access methodologies and, in particular, to a system and method for providing fine-grained temporal database access in a consistent read environment.
Most corporate computing environments perform information dissemination, storage, and processing as core functions. Generally, to facilitate information exchange, these environments are made up of intranetworks of workstations and servers operating within a single physical location. Individual intranetworks can be interconnected with other intranetworks and computational resources. Geographically-displaced intranetworks are often interconnected to form internetworks which can also be interconnected with other internetworks. Public internetworks, such as the Internet, serve to interconnect users worldwide.
Databases are playing an increasingly central role in fulfilling and supporting the core functional areas. Most databases can be configured for networked computing environments. For instance, performance sensitive database applications can be configured to operate in parallel for maximum throughput and data availability. Distributed databases take advantage of interconnectivity to enhance performance and efficiency. Finally, mission critical data is often stored on redundant database systems that are frequently geographically distributed to ensure data security.
Fundamentally, all databases include a centrally located data store with an affiliated database server. Individual users can perform transactions directly on the database via the database server using some form of query language, such as the Structured Query Language (SQL). Alternatively, database applications operating on or in conjunction with the database server can provide a user friendly front end to improve data entry, interpretation, and retrieval.
In relational databases, data values are stored in tables organized according to a schema. The schema provides a mapping of the links between data sets and defines individual attributes. Related data values are stored in rows within the tables and each data value can be defined to store virtually any type of data object, including alphanumeric strings, numeric values, or binary data. Changes to the database accrue as transactions are executed. However, only those transactions actually committed to the database will effect permanent changes to the persistent data store. Uncommitted transactions are transitory and can be rolled back or undone.
Enabling committed transactions is an essential property of databases, particularly in multi-user database systems. Ordinarily, committed transactions cause permanent changes to the database, sometimes to the detriment of a user. Committed changes, whether caused by design or by error, accident, neglect, or malicious intent, are irreversible. The changed data becomes inaccessible for retrieval and viewing, even though a user may later want to access the original unchanged data.
In the prior art, there are three basic solutions to accessing or retrieving data irreversibly changed or deleted by committed transactions. Versioning disables operations that alter or delete data values in the persistent store. Instead, a new version of any changed row is created, thereby preserving the original data values as an older version of the row. However, this approach is space inefficient can drastically increase the storage requirements of a database, particularly where the database undergoes frequent change.
Point in time recovery offers a large grained, if imprecise, approach to database recovery. The entire database is restored from a backup copy and the data values in question are inspected. The database rows are replaced with the previously modified or deleted data. However, this approach typically requires two database systems upon which to execute and compare the data and also takes the active database off-line from data processing activities until the data values are restored.
Finally, log mining enables data recovery through inference. Some database systems incorporate transaction logs which track and record all operations performed against the database. Log mining allows those operations which have effected the data to be reconstructed back into database statements and, hopefully, transposed, so as to allow committed changes to be reversed.
Therefore, there is a need for an approach to accessing data values as of a time occurring prior to a committed transaction, either by a standardized time reference or by system change number.
There is a further need for an approach that will operate in a fine-grained manner to allow selective accessing of individual data values without requiring continuous versioning or wholesale database recovery. Moreover, such an approach would operate as a simple extension to a database language without statement reconstruction.
There is a further need for a self-servicing database system that will allow a user to repair data without database administrator assistance.
The present invention provides a system and method for temporally accessing data values in a database as of a requested query time. Transactions effecting the data values stored in the database are tracked and assigned a transaction identifier. Whenever a transaction makes a change to a relative database block (or simply, xe2x80x9cdata blockxe2x80x9d), the database engine creates an interested transaction entry which is stored in the relative database block. Each interested transaction entry references a transaction table entry storing the changed data values and transaction undo information. As each transaction is applied, a new database version is created A system change number is assigned when the transaction is committed.
An embodiment of the present invention is a system and method for providing fine-grained temporal database access in a consistent read environment. A database is transitioned into successive consistent versions by tracking transactions committed to the database. Each committed transaction generates a further consistent version of the database at a journaled commit time. Transaction table entries are stored for each uncommitted transaction. Each transaction table entry stores retained data values reflecting database changes. The transaction table entries are maintained for a retention period following the commit time of each transaction. A logical view of the database is presented as of a query time occurring prior to the commit time of at least one transaction by accessing the retained data values stored in the transaction table entries for the at least one transaction.
A further embodiment is a system and method for selectively viewing temporal row data in a consistent read-implemented database. Committed transactions effecting row data changes to a database are tracked and a stored system change number is assigned upon each committed transaction. Rollback segments for uncommitted transactions are stored. Each rollback segment stores a transaction identifier and transaction table entries containing ordered row data values reflecting the database changes. The database is transitioned into successive consistent versions responsive to each committed transaction at a journaled commit time. The transaction table entries are maintained for a user-definable retention period following the commit time of each committed transaction. A queried selection of row data values from the database is performed as of a query time occurring prior to the commit time of at least one committed transaction. The ordered row data values contained in the rollback storing a transaction identifier for the at least one committed transaction are retrieved.
Another further embodiment is a system and method for performing a logical select operation on temporal row data stored in a consistent read-implemented database. A record of database operations is maintained, including transactions effecting row data changes that have been committed into a database. Rollback segments for uncommitted transactions are stored. Each rollback segment stores a transaction identifier and information pertaining to effecting or restoring the database changes, including addresses for a undo entries containing row data values reflecting the database changes. The database is transitioned into successive consistent database versions responsive to each committed transaction at a journaled commit time. A system change number is assigned to the database version upon each committed transaction. The transaction table entries are retained for a user-definable retention period following the commit time of each committed transaction. A logical select operation is executed on the database for row data values as of a query time occurring prior to the commit time of at least one committed transaction. The ordered row data values stored in the undo entries are retrieved by referencing the transaction table entries at each address included in the interested transaction entry with the transaction identifier for the at least one committed transaction.
One benefit provided by the present invention is allowing self-servicing database repair. A user who accidentally deleted important rows from a table could execute a query as of a time prior to the accidental deletion, see the missing rows, and reinsert the deleted row into the current table.
Another benefit is enabling productivity applications, such as electronic mail and voice mail programs, to provide message restoration.
Still another benefit is providing decision support system and online analytical processing applications transaction restarting capabilities. These types of applications typically perform long runs of transaction processing. In the event of a crash, these applications could take advantage of temporal access to restart processing at the point where they left off prior to crashing.
Still another benefit allows applications to incorporate implicit versioning introduced by temporal access.
Still other embodiments of the present invention will become readily apparent to those skilled in the art from the following detailed description, wherein is described embodiments of the invention by way of illustrating the best mode contemplated for carrying out the invention. As will be realized, the invention is capable of other and different embodiments and its several details are capable of modifications in various obvious respects, all without departing from the spirit and the scope of the present invention. Accordingly, the drawings and detailed description are to be regarded as illustrative in nature and not as restrictive.